-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⚠️ Remove global metrics registration in init, add registration func #2240
⚠️ Remove global metrics registration in init, add registration func #2240
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: austince The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @austince! |
Hi @austince. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
8d3d971
to
1741df4
Compare
Signed-off-by: austin ce <austin.cawley@gmail.com>
1741df4
to
ca0bf05
Compare
:warning:
Remove global metrics registration in init, add registration func
|
||
workqueue.SetProvider(workqueueMetricsProvider{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the k/k pr, we wont merge this. This breaks the majority use-case (workqueue metrics just work without doing anything
) in order to support a minority use-case (set custom provider
).
/hold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not what you were suggesting here? kubernetes/kubernetes#114242 (comment)
This is marked as a breaking change, and allows consumers to set it. Unsure what the path forward is if it is neither of the options I've proposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, my suggestion was to change the upstream workqueue to not use a sync.Once so what is set by controller-runtime can be overridden later if desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I'll send a PR for that -- seems to paper over the fact that this library is mutating global state and the "metrics just work without doing anything" use case could be addressed somewhere else (like kubebuilder, which sets up a main
), but if this gets it in 🤷🏼
I'll leave this open in the meantime if others want to weigh in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think changing kubebuilder does not really mitigate the situation. I don't have a good overview over the ecosystem but the controllers that I'm aware of don't regularly regenerate their main file with kubebuilder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okie, I'll close this then -- I've also got a PR for what Alvaro suggested here, if you guys want to drive that approach: kubernetes/kubernetes#116616
This PR removes setting the workqueue global metrics provider in an
init
method and instead provides a way for consumers of this lib to set it themselves. Otherwise, there is no way to allow consumers to use a different metrics provider.Also proposed allowing per-queue metrics providers, which would in effect also solve this problem, but the jury's out on it: kubernetes/kubernetes#114242
Closes #2238